Optimal. Leaf size=139 \[ -\frac{4 i a^3 d^2 (d \cot (e+f x))^{n-2} \, _2F_1(1,n-2;n-1;-i \cot (e+f x))}{f (2-n)}+\frac{d^2 \left (a^3 \cot (e+f x)+i a^3\right ) (d \cot (e+f x))^{n-2}}{f (1-n)}+\frac{i a^3 d^2 (1-2 n) (d \cot (e+f x))^{n-2}}{f (1-n) (2-n)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.364505, antiderivative size = 139, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 26, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.231, Rules used = {3673, 3556, 3592, 3537, 12, 64} \[ -\frac{4 i a^3 d^2 (d \cot (e+f x))^{n-2} \, _2F_1(1,n-2;n-1;-i \cot (e+f x))}{f (2-n)}+\frac{d^2 \left (a^3 \cot (e+f x)+i a^3\right ) (d \cot (e+f x))^{n-2}}{f (1-n)}+\frac{i a^3 d^2 (1-2 n) (d \cot (e+f x))^{n-2}}{f (1-n) (2-n)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3673
Rule 3556
Rule 3592
Rule 3537
Rule 12
Rule 64
Rubi steps
\begin{align*} \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^3 \, dx &=d^3 \int (d \cot (e+f x))^{-3+n} (i a+a \cot (e+f x))^3 \, dx\\ &=\frac{d^2 (d \cot (e+f x))^{-2+n} \left (i a^3+a^3 \cot (e+f x)\right )}{f (1-n)}+\frac{\left (i a d^2\right ) \int (d \cot (e+f x))^{-3+n} (i a+a \cot (e+f x)) (i a d (3-2 n)+a d (1-2 n) \cot (e+f x)) \, dx}{1-n}\\ &=\frac{i a^3 d^2 (1-2 n) (d \cot (e+f x))^{-2+n}}{f (1-n) (2-n)}+\frac{d^2 (d \cot (e+f x))^{-2+n} \left (i a^3+a^3 \cot (e+f x)\right )}{f (1-n)}+\frac{\left (i a d^2\right ) \int (d \cot (e+f x))^{-3+n} \left (-4 a^2 d (1-n)+4 i a^2 d (1-n) \cot (e+f x)\right ) \, dx}{1-n}\\ &=\frac{i a^3 d^2 (1-2 n) (d \cot (e+f x))^{-2+n}}{f (1-n) (2-n)}+\frac{d^2 (d \cot (e+f x))^{-2+n} \left (i a^3+a^3 \cot (e+f x)\right )}{f (1-n)}-\frac{\left (16 a^5 d^4 (1-n)\right ) \operatorname{Subst}\left (\int \frac{4^{3-n} \left (-\frac{i x}{a^2 (1-n)}\right )^{-3+n}}{-16 a^4 d^2 (1-n)^2-4 a^2 d (1-n) x} \, dx,x,4 i a^2 d (1-n) \cot (e+f x)\right )}{f}\\ &=\frac{i a^3 d^2 (1-2 n) (d \cot (e+f x))^{-2+n}}{f (1-n) (2-n)}+\frac{d^2 (d \cot (e+f x))^{-2+n} \left (i a^3+a^3 \cot (e+f x)\right )}{f (1-n)}-\frac{\left (4^{5-n} a^5 d^4 (1-n)\right ) \operatorname{Subst}\left (\int \frac{\left (-\frac{i x}{a^2 (1-n)}\right )^{-3+n}}{-16 a^4 d^2 (1-n)^2-4 a^2 d (1-n) x} \, dx,x,4 i a^2 d (1-n) \cot (e+f x)\right )}{f}\\ &=\frac{i a^3 d^2 (1-2 n) (d \cot (e+f x))^{-2+n}}{f (1-n) (2-n)}+\frac{d^2 (d \cot (e+f x))^{-2+n} \left (i a^3+a^3 \cot (e+f x)\right )}{f (1-n)}-\frac{4 i a^3 d^2 (d \cot (e+f x))^{-2+n} \, _2F_1(1,-2+n;-1+n;-i \cot (e+f x))}{f (2-n)}\\ \end{align*}
Mathematica [A] time = 3.57431, size = 234, normalized size = 1.68 \[ -\frac{e^{-3 i e} \left (1+e^{2 i (e+f x)}\right )^{-n-1} \left (\frac{i \left (1+e^{2 i (e+f x)}\right )}{-1+e^{2 i (e+f x)}}\right )^{n-1} \cos ^3(e+f x) (a+i a \tan (e+f x))^3 \left (2^{n+1} (n-2) \left (1+e^{2 i (e+f x)}\right )^2 \, _2F_1\left (1-n,1-n;2-n;\frac{1}{2} \left (1-e^{2 i (e+f x)}\right )\right )-\left (1+e^{2 i (e+f x)}\right )^n \left ((4 n-7) e^{2 i (e+f x)}+2 n-5\right )\right ) \cot ^{-n}(e+f x) (d \cot (e+f x))^n}{f (n-2) (n-1) (\cos (f x)+i \sin (f x))^3} \]
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [F] time = 0.322, size = 0, normalized size = 0. \begin{align*} \int \left ( d\cot \left ( fx+e \right ) \right ) ^{n} \left ( a+ia\tan \left ( fx+e \right ) \right ) ^{3}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (i \, a \tan \left (f x + e\right ) + a\right )}^{3} \left (d \cot \left (f x + e\right )\right )^{n}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F] time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left (\frac{8 \, a^{3} \left (\frac{i \, d e^{\left (2 i \, f x + 2 i \, e\right )} + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} - 1}\right )^{n} e^{\left (6 i \, f x + 6 i \, e\right )}}{e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, e^{\left (2 i \, f x + 2 i \, e\right )} + 1}, x\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (i \, a \tan \left (f x + e\right ) + a\right )}^{3} \left (d \cot \left (f x + e\right )\right )^{n}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]